<div class="panel panel-default panel-intro">

    <div class="panel-heading">
        {:__('Info')}
    </div>
    <div class="panel-body newrow">


        <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="" onsubmit="return true">
            <input type="hidden" name="row[ids]" value="{$detail[0]['id']}">
            <div data-toggle="cxselect" data-selects="first,second">
                <div class="row">
                    <div class="col-md-4 col-xs-12 form-group">
                        <label class="control-label col-xs-12 col-sm-3">{:__('Code')}:</label>
                        <div class="col-xs-12 col-sm-6">
                            <input id="c-code" value="{$detail[0]['code']}" class="form-control" name="row[code]" type="text">
                        </div>
                    </div>
                    <div class="col-md-4 col-xs-12 form-group">
                        <label class="control-label col-xs-12 col-sm-3">{:__('Customer_name')}:</label>
                        <div class="col-xs-12 col-sm-6">
                            <input  data-rule="required;" id="c-supplier" name="row[customer_name]" disabled="" value="{$detail[0]['customer_name']}" class="form-control" type="text"  data-toggle="modal" data-target="#myModal">
                            <input  id="c-supId" class="form-control"  value="{$detail[0]['customer_info_id']}" style="display: none;" type="text"  data-toggle="modal" data-target="#myModal">
                        </div>
                    </div>
                    <div class="col-md-4 col-xs-12 form-group">
                        <label class="control-label col-xs-12 col-sm-3">{:__('Select sell')}:</label>
                        <div class="col-xs-12 col-sm-6">
                            <input   id="c-purchase" disabled="" class="form-control" value="{$detail[0]['sell_code']}" type="text"  >
                            <input  id="c-pur" class="form-control"  value="{$detail[0]['sell_id']}" style="display: none;" type="text">
                            <input  id="c-code" class="form-control"  value="{$detail[0]['sell_code']}" style="display: none;" type="text">

                        </div>
                    </div>
                    <div class="col-md-4 col-xs-12 form-group">
                        <label class="control-label col-xs-12 col-sm-3">{:__('Contact')}:</label>
                        <div class="col-xs-12 col-sm-6">
                            <input id="c-contact" class="form-control" value="{$detail[0]['linkman']}" name="row[linkman]" type="text">
                        </div>
                    </div>
                    <div class="col-md-4 col-xs-12 form-group">
                        <label class="control-label col-xs-12 col-sm-3">{:__('Phone')}:</label>
                        <div class="col-xs-12 col-sm-6">
                            <input id="c-phone" data-rule="required;mobile|tel" value="{$detail[0]['phone']}" class="form-control" name="row[phone]" type="text" >
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-4 col-xs-12 form-group">
                        <label class="control-label col-xs-12 col-sm-3">{:__('Delivery')}:</label>
                        <div class="col-xs-12 col-sm-6">
                            <input id="c-delivery_dates" data-rule="required;" value="{$detail[0]['delivery_time']}" data-date-format=" YYYY-MM-DD" class="form-control datetimepicker" name="row[delivery_time]" type="text" >
                        </div>
                    </div>
                    <div class="col-md-4 col-xs-12 form-group">
                        <label class="control-label col-xs-12 col-sm-3">{:__('Type')}:</label>
                        <div class="col-xs-12 col-sm-6">
                            <select id="c-type" class="form-control" name="row[type]">
                                <option {$detail[0]['type']==1?"selected":""} value="1">{:__('Type 1')}</option>
                                <option {$detail[0]['type']==2?"selected":""} value="2">{:__('Type 2')}</option>
                                <option {$detail[0]['type']==3?"selected":""} value="3">{:__('Type 3')}</option>
                            </select>
                        </div>

                    </div>
                    <div class="col-md-4 col-xs-12 form-group">
                        <label class="control-label col-xs-12 col-sm-3">{:__('Billing')}:</label>
                        <div class="col-xs-12 col-sm-6">
                            <input id="c-billing_date" class="form-control datetimepicker" data-date-format=" YYYY-MM-DD" data-date-default-date={$date} name="row[billing_time]" type="text" >
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6 col-xs-12 form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
                        <div class="col-xs-12 col-sm-6" >
                            <input id="c-city" date-rule="required;" data-toggle="city-picker" value="{$detail[0]['city']}" class="form-control" name="row[city]" type="text"  >
                            <!--   <div class='control-relative'><input id="c-city" class="form-control" data-toggle="city-picker" name="row[city]" type="text"></div> -->
                        </div>
                        <div class="col-xs-12 col-sm-4" >
                            <input type="text" id="c-address" name="row[address]" value="{$detail[0]['address']}" class="form-control" placeholder="输入详细地址" name="">
                        </div>
                    </div>

                </div>
                <div class="row">
                    <div class="col-md-6 col-xs-12 form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
                        <div class="col-xs-12 col-sm-6">
                            <textarea id="c-remark" class="form-control " value="" rows="3" name="row[remark]" cols="30">{$detail[0]['remark']}</textarea>
                        </div>
                    </div>
                </div>
                <div class="table-responsive">
                    <table style="" id="table" class="main-table table table-striped table-bordered table-hover table-nowrap">
                        <thead>
                        <th>{:__('Serial number')}</th>
                        <th>{:__('Sku')}</th>
                        <th>{:__('Commodity')}</th>     
                        <th>{:__('Specification')}</th>
                        <th>{:__('Attributes')}</th>
                        <th>{:__('Unit')}</th>
                        <th>{:__('Locate')}</th>
                        <th>{:__('Inventory')}</th>
                        <th>{:__('Delivery quantity')}</th>
                        <th>{:__('unit price')}</th>
                        <th>{:__('Subtotal')}</th>
                        <th>{:__('Remarks')}</th>
                        <th>{:__('Operate')}</th>
                        </thead>
                        <tbody>
                            {foreach :$product as $key=>$vo } 
                            <tr>
                                <td>{$key+1}</td>
                                <td>{$vo.products['sku']}</td>
                                <td><input date-rule="required;" disabled="" data-pro-id=""  type="text" name="" value="{$vo.products['name']}" data-id="" class="find" class="" data-toggle="modal" ></td>
                                <td>{$vo.products['specification']}</td>
                                <td>
                                    {volist name="$vo.products['prop']" id="val"}
                                    {$val.title}:{:isset($val['value'])?$val['value']:""}
                                    {/volist}
                                </td>
                                <td class="unit">{$vo.products.unit}</td>
                                <td class="locate">
                                    <input date-rule="required;" data-pro-id="" value="{$vo.w_name}/{$vo.p_name}"  type="text" name="" data-id="{$vo.id}" class="find2">
                                    <input type="hidden" class="wp_id" value="{$vo.wp_id}" name="wp_id">
                                    <input type="hidden" class="inv" name="inventory">
                                </td>
                                <!--        <td> <select  class="second form-control"  data-url="purchase/addorder/getWarehouse" data-query-name="pid" style="width: 100%">
                               <option value="2" selected="">001</option>
                               </select>
                             </td >-->
                                <td><input  type="number" name="" disabled=""  class="inventory" value="{$vo.nums}" readonly="readonly" style="" ></td>
                                <td><input  type="number" name="" disabled="" value="{$vo.price}" data-rule="required;integer;range(0~);"  class="nums" onblur="totalNums(this)"></td>
                                <td><input  type="number" value="{$vo.subtotal}" disabled="" data-rule="required;" onblur="calMoney(this)" class="unit-price" name=""></td>
                                <td class="subtotal"></td>
                                <td> <textarea rows="2" class="remarks" value="" cols="20">{$vo.remark}</textarea></td>
                                <td>
                                    <button type="button" class="btn btn-primary adds" disabled="disable onclick="addRow()">{:__('Add')}</button>
                                    <button type="button" class="btn btn-default del" disabled="disable onclick="delRow(this)">{:__('Delete')}</button>
                                </td>
                            </tr>
                            {/foreach}
                            <tr>
                                <td>{:__('Total')}</td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td class="totalnums" >{$detail[0]['totalNums']} </td>
                                <td></td>
                                <td id="allMoney"></td>
                                <td></td>
                                <td></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div>

                    <div class="row">
                        <div class="col-md-7 col-xs-12">
                        </div>
                        <div class="col-md-3 col-xs-12">
                            <!-- <label class="control-label col-xs-12 col-sm-6">{:__('Rate')}:</label>
                             <div class="col-xs-12 col-sm-6">
                                <input id="c-rate" class="form-control"  name="row[rate]" type="number" value="15" onblur="calTotalMoneys()">
                              
                             </div> -->
                        </div>
                        <div class="col-md-2 col-xs-12">
                            <!-- {:__('Amounts payable $')}<span id="totalMoney">0.00</span> -->
                            <!-- <input id="totalMoneys" style="display: none;" name="row[totalMoney]"  readonly="readonly"  type="" name=""> -->
                            <input id="money" style="display: none;" name=""  readonly="readonly"  type="" name="">
                            <input id="allNums" style="display: none;" name=""  readonly="readonly"  type="" name="">
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-10 col-xs-12">
                    </div>
                    <div class="col-md-2 col-xs-12">
                        <div class="col-xs-12 col-sm-5">
                        </div>
                        <button type="button" onclick="editSubmitData()" class="btn btn-success btn-embossed">{:__('OK')}</button>
                    </div>
                </div>
            </div>

        </form>

    </div>

</div>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">{:__('Select supplier')}</h4>
            </div>
            <div class="modal-body">
                <div id="lays-row" class="row">
                    <table id="table1" class="table table-striped table-bordered table-hover " data-show-export="false" data-show-toggle="false" data-show-columns="false">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="modelProduct" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">{:__('Select Warehouse')}</h4>
            </div>
            <div class="modal-body">
                <div id="lays-row" class="row">
                    <table id="table2" class="table table-striped table-bordered table-hover " data-show-export="false" data-show-toggle="false" data-show-columns="false">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 选择仓库Modal -->
<div class="modal fade" id="modelWarehouse" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">{:__('Locate')}</h4>
            </div>
            <div class="modal-body">
                <div id="lays-row" class="row">
                    <table id="table4" class="table table-striped table-bordered table-hover " data-show-export="false" data-show-toggle="false" data-show-columns="false">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- Modal -->
<div class="modal fade" id="modelPurchase" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">{:__('Select sell')}</h4>
            </div>
            <div class="modal-body">
                <div id="lays-row" class="row">
                    <table id="table3" class="table table-striped table-bordered table-hover " data-show-export="false" data-show-toggle="false" data-show-columns="false">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
